<?php
/**
 * 网点管理
 */
class BranchController extends Controller {

    public $Module = 'crm';
    public $Controller = 'branch';
    public $Action = 'index';
    public $UserConfig = array();

    public function IndexAction() {
        // 赋值
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_'.$this->Action);
    }

    public function AddAction(){
        // 赋值
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }    
    
    public function EditAction(){
        // 赋值
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }
    
    public function SaveAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, 'add');
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }
    
    public function UpdateAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, 'edit');
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }
    
    public function RemoveAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }
    /*
    **
    **网点审核配置
    */
    public function AuditconfigAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }
    
    /*
    **
    **网点合同列表
    */
    public function ContractlistAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }

    public function ContractaddAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }

    public function ContracteditAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }

    public function ContractsaveAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }

    public function BankaccounteditAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }

     public function ContractremoveAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }


    public function UserlistAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }
    
    public function UsereditAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, 'userlist');
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/member_operate');
    }

    public function ClosebranchAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }
    
    public function UsersaveAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, 'userlist');
        $this->LoadHelper($this->Module. '/member_operate');
    }
    
    public function UserremoveAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, 'userlist');
        $this->LoadHelper($this->Module. '/member_operate');
    }
    //上牌地准入限制
    public function UnadmittanceAction(){
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        if (empty($this->UserConfig['Id'])) {
            header('Location:/auth/login');
            exit();
        }
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }

    //每月20号执行
    public function GetvalueAction(){
        // 赋值
        $this->Config = Config::GetConfig();
        $this->Assign('Config', $this->Config);
        $this->UserConfig = Cookie::GetMember('crm');
        $this->Assign('UserConfig', $this->UserConfig);
        $this->SetPurview($this->UserConfig, $this->Module, $this->Controller, $this->Action);
        $this->SetView($this->Module . '/common');
        $this->AddView($this->Module . '/' . $this->Controller);
        $this->LoadHelper($this->Module. '/' .$this->Controller.'_operate');
    }
    
}